#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>

int main() {
    long N;
    long arr[10] = { 0 };
    scanf("%ld", &N);
    int count = 0;
    long tmp = N;
    while (tmp)
    {
        tmp /= 10;
        count++;
    }
    tmp = N;
    for (int i = 0; i < count; i++)
    {
        arr[i] = tmp % 10;
        tmp = tmp / 10;
    }
    //for (int i = 0, j = count - 1; i < count / 2; i++, j--)
    //{
    //    int t = arr[i];
    //    arr[i] = arr[j];
    //    arr[j] = t;
    //}
    if (count > 3)
    {
        if (count / 3.0 > 1 && count / 3.0 <= 2)
        {
            //int end = count - 1;
            //for (int i = 0; i < 3; i++)
            //{
            //    arr[end + 1] = arr[end]; 
            //    end--;
            //}
            //arr[end - 3] = ',';
            //count++;
            for (int i = 0; i < count; i++)
            {
                if (i == 3)
                {
                    printf(",");
                    printf("%d", arr[count - 1 - i]);

                }
                else
                {
                    printf("%d", arr[count - 1 - i]);
                }
            }
        }
        if (count / 3.0 > 2 && count / 3.0 <= 3)
        {
            //int end = count - 1;
            //for (int i = 0; i < 7; i++)
            //{
            //    arr[end + 1] = arr[end];
            //    end--;
            //}
            //arr[end - 7] = ',';
            //count += 2;
            for (int i = 0; i < count; i++)
            {
                if (i == 3 || i == 6)
                {
                    printf(",");
                    printf("%d", arr[count - 1 - i]);
                }
                else
                {
                    printf("%d", arr[count - 1 - i]);
                }
            }

        }
        if (count / 3.0 > 3)
        {
            //int end = count - 1;
            //for (int i = 0; i < 11; i++)
            //{
            //    arr[end + 1] = arr[end];
            //    end--;
            //}
            //arr[end - 11] = ',';
            //count += 3;
            for (int i = 0; i < count; i++)
            {
                if (i == 3 || i == 6 || i == 10)
                {
                    printf(",");
                    printf("%d", arr[count - 1 - i]);

                }
                else
                {
                    printf("%d", arr[count - 1 - i]);
                }
            }

        }
        //for (int i = 0; i < count; i++)
        //{
        //    printf("%d", arr[i]);
        //}
    }
    else
    {
        printf("%ld", N);
    }
    return 0;
}